package com.kll.tv.views

import android.view.View
import com.kll.carolinehmibiz.presentation.BasePresenter
import com.kll.tv.base.views.BaseActivity
import com.kll.tv.databinding.ActivityUpdateNameBinding
import com.tencent.qcloud.tuicore.util.SoftKeyBoardUtil

/**
 * 设置名字页
 */
class UpdateNameActivity: BaseActivity<BasePresenter>() {
    private lateinit var binding: ActivityUpdateNameBinding

    override fun initViewBinding(): View {
        binding = ActivityUpdateNameBinding.inflate(layoutInflater)
        return binding.root
    }

    override fun createPresenter(): BasePresenter {
        return BasePresenter(this)
    }

    override fun init() {

        initListener()
    }

    private fun initListener() {
        binding.tvCancel.setOnClickListener {
            finish()
        }
        binding.tvOk.setOnClickListener {

        }

        binding.edtName.setOnFocusChangeListener(object : View.OnFocusChangeListener {
            override fun onFocusChange(v: View?, hasFocus: Boolean) {
                if (!hasFocus) {
                    SoftKeyBoardUtil.hideKeyBoard(binding.edtName.windowToken)
                } else {
                    SoftKeyBoardUtil.showSoftInput(binding.edtName)
                }
            }

        })
    }
}